#!/bin/sh
# MCP for Tally launcher: picks the Node runtime for this Mac and passes the arguments through.
# AI apps start it as ".../MCP for Tally.app/Contents/MacOS/mcpfortally mcp".
CONTENTS="$(cd "$(dirname "$0")/.." && pwd)"
case "$1" in -psn_*) shift ;; esac
if [ "$(uname -m)" = "arm64" ] || [ "$(sysctl -in sysctl.proc_translated 2>/dev/null)" = "1" ]; then
  NODE="$CONTENTS/Resources/runtime/node-arm64"
else
  NODE="$CONTENTS/Resources/runtime/node-x64"
fi
export MFT_LAUNCHER="$CONTENTS/MacOS/mcpfortally"
APP="$CONTENTS/Resources/app/mcpfortally.js"
if [ "$#" -eq 0 ]; then
  exec "$NODE" "$APP" app >/dev/null 2>&1
fi
exec "$NODE" "$APP" "$@"
